package isScramble

import (
	"math/rand"
	"time"
)

// func isScramble(s1 string, s2 string) bool {

// }

func scramble(s string) string {
	l := len(s)
	if l == 1 {
		return s
	}

	var m int
	for {
		rand.Seed(time.Now().Unix())
		if m = rand.Intn(l); m == 0 {
			continue
		}
		break
	}

	s1 := scramble(s[:m])
	s2 := scramble(s[m:])

	var r string
	rand.Seed(time.Now().Unix())
	b := rand.Intn(100)
	if b%2 == 1 {
		r = s2 + s1
	} else {
		r = s1 + s2
	}

	return r
}
